// pages/hospital/consult/consult.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    img_src:getApp().img_src,
    current:0,
    type:0,
    deptId:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.init()
  },
  init(){
    var t = this
    getApp().request({
      url:'https://live.sgwxmini.com/beauty/consultationInquiry/getCategory',
      data:{hos_id:getApp().api.siteinfo.hosId},
      success(e){
        var list = [{name:'全部',id:'',dept_id:0}]
        e.data.forEach(item=>{list.push(...item.categorys)})
        t.setData({typeList:list})
      }
    })
    getApp().request({
      url:'https://live.sgwxmini.com/beauty/consultationInquiry/index',
      data:{deptId:1,hosId:getApp().api.siteinfo.hosId},
      success(e) {
        t.setData({banner:e.plasticEncyclopedias})
      }
    })
    getApp().request({
      url:getApp().api.siteinfo.apiroot+'action/doctor',
      data:{storeId:getApp().api.siteinfo.acid},
      loading:true,
      success(e) {
        t.setData({doctorList:e.doctors})
      }
    })
    getApp().request({
      url:'https://live.sgwxmini.com/beauty/consultationInquiry/getQuestions',
      data:{
        pageSize:100,
        pageNum:1,
        categoryId:0,
        deptId:0,
        hosId:getApp().api.siteinfo.hosId,
        crmId:-1
      },
      success(e) {
        t.setData({q_a:e.data})
      }
    })
  },

  bindchange(e){
    this.setData({current:e.detail.current})
  },
  typeTap(e){
    this.setData({
      type:e.target.dataset.item.id,
      deptId:e.target.dataset.item.dept_id
    })
  },
  is_web(e){
    wx.navigateTo({
      url:getApp().querystring(e.currentTarget.dataset.url)
    })
  },
  is_web(e){
    wx.navigateTo({
      url:getApp().querystring(e.currentTarget.dataset.url)
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})